﻿Imports System.Collections.Specialized
Imports System.IO
Imports System.Globalization
Imports Microsoft.TeamFoundation.Client
Imports Microsoft.TeamFoundation.WorkItemTracking.Client
Imports System.Collections.ObjectModel
Imports System

Imports System.ComponentModel

Imports System.Xml.Serialization

Imports System.Threading

Namespace Controlers

    Public MustInherit Class ControlerBase(Of TView As {IView, UIElement})
        Implements INotifyPropertyChanged

        Private m_View As TView

        Public ReadOnly Property View() As TView
            Get
                Return m_View
            End Get
        End Property

#Region " INotifyPropertyChanged "

        Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

        Public Sub OnPropertyChanged(ByVal PropertyName As String)
            If Not PropertyChangedEvent Is Nothing Then
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(PropertyName))
            End If
        End Sub

#End Region

        Private m_Working As Boolean = False

        Public Property Working() As Boolean
            Get
                Return m_Working
            End Get
            Protected Set(ByVal value As Boolean)
                If Not value = m_Working Then
                    m_Working = value
                    OnPropertyChanged("Working")
                End If
            End Set
        End Property

        Private m_SuperControler As ControlerFactory(Of TView)

        Public Sub New(ByVal view As IView)
            m_View = view
        End Sub

        Public Property Factory() As ControlerFactory(Of TView)
            Get
                Return m_SuperControler
            End Get
            Friend Set(ByVal value As ControlerFactory(Of TView))
                m_SuperControler = value
            End Set
        End Property

        Public MustOverride Sub Reset()

    End Class

End Namespace